﻿<?php
session_start();

if (!isset($_SESSION['login']) && !$_SESSION['login'] == true) {
	header ("Location: index.php");
}
include("LangHeader.php");
include 'config.php';

mysqli_set_charset($con, 'utf8');

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="scripts/jquery.tablesorter.js"></script>
<title>Sales Makeover</title>
</head>

<body>
	<div class="bodyLeft" id="bodyLeft">
		<?php include("menu.html"); ?>
	</div>
	<div class="bodyRight" id="bodyRight">
		<div class="container_head">
			<?php include("header.html"); ?>
		</div>
		<div class="container" id="container">
			<div class="content">
				
				<center>
				<img border="0" src="content\icons\Buttons\step_1_inactive.png" width="50">
				<img border="0" src="content\icons\Buttons\step_2_active.png" width="50">
				<br>
				<br>
				</center>
				
				
				<div style='color:white; text-align:left;width:90%;margin-left:auto;margin-right:auto;' class="tr" key="create_Info2"></div><br/>
				
				
				<form id="create_Innovation_step_1" class="create_Innovation_step_1"  method="post" action="createNewInnovation.php" accept-charset="UTF-8" onsubmit="return validateForm()">
					<input type="hidden" name="Customer" value="<?php if(isset($_POST['Customer'])) { echo $_POST['Customer']; }?>">
					<input type="hidden" name="Project" value="<?php if(isset($_POST['Project'])) { echo $_POST['Project']; }?>">
					<input type="hidden" name="BusinessValue" value="<?php if(isset($_POST['BusinessValue'])) { echo $_POST['BusinessValue']; }?>">
					<input type="hidden" name="OwnerRole" value="<?php if(isset($_POST['OwnerRole'])) { echo $_POST['OwnerRole']; }?>">
					<input type="hidden" name="Contact" value="<?php if(isset($_POST['Contact'])) { echo $_POST['Contact']; }?>">
					
					<div class="createInnovation2Label tr" key="create_Ide"></div>
					<input type="text" name="Recommendation">
					<div class="createInnovation2Label tr" key="create_problem"></div>
					<input type="text" name="Problem">
					<br/>
					<div class="createInnovation2Label tr" key="create_Solution"></div>
					<input type="text" name="Solution">
					<div class="createInnovation2Label tr" key="create_Value2"></div>
					<input type="text" name="CustomerValue">
					<br/>
					<div class="createInnovation2Label tr" key="create_NextStep"></div>
					<select name="NextStep"style='width:84%;'>
						<option selected disabled>-----</option>
						<?php 
						$stmt = $con->prepare('SELECT * FROM Innovation_NextStep');
						$stmt->execute();
						$result = $stmt->get_result();		
			
						while($row =  $result->fetch_assoc())
						{
							echo "<option value=\"" . $row['ID'] . "\" class=\"tr\" key=\"". $row['Value'] ."\"></option>";
						}
						
						?>
					</select>
					<div class="createInnovation2Label tr" key="create_Timetable"></div>
					<select name="TimeFrame"style='width:84%;'>
						<option selected disabled>-----</option>
						<?php 
						
						$stmt = $con->prepare('SELECT * FROM Innovation_TimeFrame');
						$stmt->execute();
						$result = $stmt->get_result();
			
						while($row2 = $result->fetch_assoc())
						{
							echo "<option value=\"" . $row2['ID'] . "\" class=\"tr\" key=\"". $row2['Value'] ."\"></option>";
						}
						
						?>
					</select>
					
					<input type="submit"  class="tr" key="button_Send">
					<div style="margin-top:30px;">
					
					</div>
				</form>
				
			</div>
		</div>
	</div>
</body>

</html>
<script type="text/javascript" charset="UTF-8">
	function validateForm()
	{
		var RecommendationVal = document.forms["create_Innovation_step_1"]["Recommendation"].value;
		if(RecommendationVal == "")
		{
			alert(getText("error_Recommendation"));
			return false;
		}	
		var ProblemVal = document.forms["create_Innovation_step_1"]["Problem"].value;
		if(ProblemVal == "")
		{
			alert(getText("error_Problem"));
			return false;
		}
		var SolutionVal = document.forms["create_Innovation_step_1"]["Solution"].value;
		if(SolutionVal == "")
		{
			alert(getText("error_Solution"));
			return false;
		}
		var CustomerValueVal = document.forms["create_Innovation_step_1"]["CustomerValue"].value;
		if(CustomerValueVal == "")
		{
			alert(getText("error_CustomerValue"));
			return false;
		}
		var NextStepVal = document.forms["create_Innovation_step_1"]["NextStep"].value;
		if(NextStepVal == "-----")
		{
			alert(getText("error_NextStep"));
			return false;
		}
		var TimeFrameVal = document.forms["create_Innovation_step_1"]["TimeFrame"].value;
		if(TimeFrameVal == "-----")
		{
			alert(getText("error_TimeFrame"));
			return false;
		}
	};
</script>